<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=
    , initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    function strConvert(str) {
        let arr = [];
        let str1;
        for (let i = 0; i < str.length; i++) {
            if (str.charCodeAt(i) >= 97 && str.charCodeAt(i) <= 123) {
                str1 = str[i].toUpperCase();
            } else {
                str1 = str[i].toLowerCase();
            }
            arr.push(str1)
        }
        console.log(arr.join(""));
    }
    strConvert("HelloWorld")
</script>